"use strict";
const defaultAppealReasons = [
  "我的评论内容没有任何问题，是被恶意举报脚本举报导致的误删除，请求恢复我的评论。",
  "我的评论符合平台规则，可能是被恶意举报，恳请恢复。",
  "此评论并无违规，应该是误判，希望能恢复。",
  "我的言论遵循社区规范，遭恶意举报致使评论被删，望恢复。",
  "评论内容健康且积极，无端被删，望查明并恢复。",
  "此条评论是正常交流，不存在违规，误删请恢复。",
  "我按平台规定发表评论，却被恶意处理，请求恢复。",
  "评论内容无任何不当之处，疑似误删，盼恢复。",
  "我的发言符合平台要求，被恶意举报删除，望恢复。",
  "评论内容合理合规，被错误处理，恳请恢复。",
];

document.addEventListener("DOMContentLoaded", () => {
  chrome.storage.sync.get("defaultAppealReason", (data) => {
    const randomIndex = Math.floor(Math.random() * defaultAppealReasons.length);
    const dfar = data.defaultAppealReason || defaultAppealReasons[randomIndex];
    document.getElementById("defaultAppealReason").value = dfar;
  });

  document
    .getElementById("saveDefaultAppealReason")
    .addEventListener("click", () => {
      const dfarInput = document.getElementById("defaultAppealReason");
      const defaultAppealReason = dfarInput.value;
      chrome.storage.sync.set({ defaultAppealReason }, () => {
        alert("保存成功");
        window.location.href = "po.html";
      });
    });
  document.getElementById("backToPo").addEventListener("click", () => {
    window.location.href = "po.html";
  });
});
